package ttOrder.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
//import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import ttOrder.service.commonService;
import ttOrder.util.CookieUtil;

@Controller
@RequestMapping("/ttOrder")
public class commonController {
	
	@Resource
    private commonService service;

	/*测试cookie操作*/
	
	@RequestMapping("/")
	public String index(Model model,HttpServletResponse response){
		model.addAttribute("well", "emoker");
		CookieUtil.saveTableIdToCookie(response, 99);
		//CookieUtil.clearTableIdFromCookie(response);
		return "Backstage/login";
	}
	/*
//import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import ttOrder.model.po.User;
import ttOrder.service.commonService;
import ttOrder.util.CookieUtil;

@RestController
public class commonController {
	
	@Resource
    private commonService service;

	/*测试cookie操作*/
	/*
	@RequestMapping("/")
	public ModelAndView index(Model model,HttpServletResponse response){
		model.addAttribute("well", "emoker");
		CookieUtil.saveTableIdToCookie(response, 99);
		//CookieUtil.clearTableIdFromCookie(response);
		return new ModelAndView("index");
	}
	
>>>>>>> branch 'master' of https://gitee.com/emoker/ttOrder.git
	@RequestMapping("/1")
	public ModelAndView index1(Model model,HttpServletResponse response,HttpServletRequest request){
		model.addAttribute("well", "emoker");
		//CookieUtil.saveTableIdToCookie(response, 99);
		//CookieUtil.clearTableIdFromCookie(response);
		int t = CookieUtil.getTableIdFromCookie(request);
		System.out.println("cookie : "+t);
		return new ModelAndView("index");
	}*/
	
	/*@RequestMapping("/users")
	public List<User> users(){
        return service.testUsers();
    }*/
	
}
